Skip to main content

BitBucket Pipelines

The steps below send test results from Bitbucket Pipelines to BuildPulse with an API token.

If you'd like help at any step, please get in touch at support@buildpulse.io

1. Create an API key.

In BuildPulse, open Organization Settings, then API Keys, and click Create API Key. The key starts with bp_ and is shown once.

In Bitbucket, open Repository settings, then Pipelines, then Repository variables. Add the key as BUILDPULSE_API_TOKEN and tick Secured.

2. Copy the upload step for your repository.

In BuildPulse, open the repository and go to its Setup tab. Under "Wire BuildPulse into your CI pipeline", pick Bitbucket Pipelines and your test framework. The page shows the step below with your repository ID filled in.

The BuildPulse reporter is published as a GitHub Action. It reads Bitbucket's build variables correctly, so on Bitbucket Pipelines it is run directly as a Node script. Add this after your test step in bitbucket-pipelines.yml, replacing <your-repository-id> with the ID from the Setup tab and junit.xml with where your test framework writes its JUnit XML:

- step:
name: Upload test results to BuildPulse
# The reporter is a Node script, so this step needs an image that has node,
# even when the rest of your pipeline runs on another image.
image: node:20
script:
- git clone --depth 1 https://github.com/BuildPulseLLC/test-reporter-action.git /tmp/buildpulse
# 'env' is required: the input names contain hyphens, which a plain
# VAR=value shell prefix cannot express.
- env INPUT_PATH="junit.xml"
INPUT_REPOSITORY="<your-repository-id>"
INPUT_API-TOKEN="$BUILDPULSE_API_TOKEN"
node /tmp/buildpulse/dist/index.js

To upload coverage as well, add INPUT_COVERAGE-FILES="coverage/lcov.info" (LCOV or Cobertura XML) to the env line.

The JUnit XML has to reach this step. Declare it under artifacts in your test step, and make sure the upload still runs when tests fail, which is where flaky tests show up.

3. Commit the changes to your bitbucket-pipelines.yml.

Push your branch to Bitbucket and check the "Upload test results to BuildPulse" step in the pipeline. Within a few minutes the repository's Test Runs tab in BuildPulse shows the run.

Using the BuildPulse pipe?

Earlier versions of this guide used the BuildPulse Bitbucket pipe with an access key ID and secret access key plus numeric account and repository IDs. New accounts are not issued access keys, so new setups should follow the steps above. If you already use the pipe and have questions about moving, email support@buildpulse.io.